// BcstDataProviderTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "../BcstDataProvider/include/BcstDataProviderFactory.h"
#include "../BcstDataProvider/include/BcstDataProvider.h"
#include <Windows.h>
#include <iostream>
#include "../BcstDataProvider/libjson/include/IBlocksProvider.h"
#include "../BcstDataProvider/include/FileDownloader.h"

using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
	std::string strStatus = "http://172.30.56.88:8080/ads/getAdsStatus.action";
	std::string strSlots = "http://172.30.56.88:8080/ads/getAdCasterAdSlots.action";
	std::string strAdList ="http://172.30.56.88:8080/ads/getAdCasterAdList.action?adSlotID=14&max=10" ;
	BcstDataProvider* pProvider=BcstDataProviderFactory::Instance()->CreateFileDataSourceBcstDataProvider("c:/json");
	//BcstDataProvider* pProvider=BcstDataProviderFactory::Instance()->CreateHTTPDataSourceBcstDataProvider(strStatus,strSlots,strAdList);
	ALL_SLOTS_VECTOR adList=pProvider->GetAdListForAllSlot();
	int nCount=adList.size();
	Sleep(5000);
	adList=pProvider->GetAdListForAllSlot();
	nCount=adList.size();

	FileDownloader downloader;
	int bufferSize=1024*1024;
	char* buffer=new char[bufferSize];
	memset(buffer,0,bufferSize);
	downloader.Download("www.baidu.com",buffer,bufferSize);

	cout<<buffer<<endl;

	cout<<"the adlist count is:"<<nCount<<endl<<"please enter any key continue...\n";
	std::string temp;
	cin>>temp;
	return 0;
}

